
-- ----------------------------
--  Table structure for `iadminos_curd`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_curd`;
CREATE TABLE `iadminos_curd` (
  `id` int(10) NOT NULL AUTO_INCREMENT,
  `title` varchar(20) DEFAULT NULL,
  `content` text,
  `state` tinyint(4) DEFAULT NULL,
  `post_date` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-- ----------------------------
--  Records of `iadminos_curd`
-- ----------------------------
BEGIN;
INSERT INTO `iadminos_curd` VALUES ('1', 'PhalApi', '欢迎使用PhalApi 2.x 版本!', '0', '2017-07-08 12:09:43'), ('2', '版本更新', '主要改用composer和命名空间，并遵循psr-4规范。', '1', '2017-07-08 12:10:58');
COMMIT;

-- ----------------------------
--  Table structure for `iadminos_portal_admin`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_portal_admin`;
CREATE TABLE `iadminos_portal_admin` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(20) NOT NULL DEFAULT '' COMMENT '管理员账号',
  `password` varchar(100) NOT NULL DEFAULT '' COMMENT '密码',
  `salt` varchar(64) NOT NULL DEFAULT '' COMMENT '盐值',
  `role` varchar(20) NOT NULL DEFAULT 'admin' COMMENT '管理员角色，admin普通管理员，superadmin超级管理员',
  `state` tinyint(4) NOT NULL DEFAULT '1' COMMENT '状态，1可用0禁止',
  `created_at` datetime DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2;

-- ----------------------------
--  Records of `iadminos_portal_admin`
-- ----------------------------
BEGIN;
INSERT INTO `iadminos_portal_admin` VALUES ('1', 'admin', 'dc82654309a03d3969add27cee6bf11f', 'cAOQ3WuLq5Er5DElLgXFInpteLHhSGETaCW0Uh7iaRIEYs2i2I1OwYQYgJsiIyQ0', 'admin', '1', '2020-11-08 19:31:52');
COMMIT;

-- ----------------------------
--  Table structure for `iadminos_portal_admin_role`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_portal_admin_role`;
CREATE TABLE `iadminos_portal_admin_role` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `role` varchar(20) NOT NULL DEFAULT '' COMMENT '管理员角色',
  `role_name` varchar(255) NOT NULL DEFAULT '' COMMENT '管理员角色名称',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3;

-- ----------------------------
--  Records of `iadminos_portal_admin_role`
-- ----------------------------
BEGIN;
INSERT INTO `iadminos_portal_admin_role` VALUES ('1', 'superadmin', '超级管理员'), ('2', 'admin', '普通管理员');
COMMIT;

-- ----------------------------
--  Table structure for `iadminos_portal_menu`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_portal_menu`;
CREATE TABLE `iadminos_portal_menu` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(50) DEFAULT NULL,
  `icon` varchar(50) DEFAULT NULL,
  `href` varchar(255) DEFAULT NULL,
  `target` varchar(10) DEFAULT '_self',
  `sort_num` int(11) DEFAULT '0',
  `parent_id` int(11) DEFAULT '0',
  `assign_admin_roles` varchar(1000) DEFAULT '' COMMENT '管理员角色分配，多个用竖线分割',
  `assgin_admin_usernames` text COMMENT '分配的管理员ID，多个用竖线分割',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001;

-- ----------------------------
--  Records of `iadminos_portal_menu`
-- ----------------------------
BEGIN;
INSERT INTO `iadminos_portal_menu` VALUES ('1', '运营后台', 'fa fa-address-book', null, '_self', '1', '0', '', null), ('2', '页面示例', 'fa fa-address-book', null, '_self', '2', '0', '', null), ('3', '应用市场', 'fa fa-rocket', 'http://www.phalapi.net', '_self', '3', '0', '', null), ('21', '应用市场', 'fa fa-rocket', 'page/phalapi-plugins/index.html', '_self', '1', '3', '', null), ('22', '我的应用', 'fa fa-rocket', 'page/phalapi-plugins/mine.html', '_self', '2', '3', '', null), ('23', '菜单管理', 'fa fa-window-maximize', 'page/menu.html', '_self', '2', '1', '', null), ('24', 'CURD表格示例', 'fa fa-list-alt', 'page/phalapi-curd-table/index.html', '_self', '5', '1', '', null), ('25', '用户', 'fa fa-users', 'page/phalapi-user/index.html', '_self', '5', '1', '', null), ('101', '首页', 'fa fa-home', 'page/welcome-1.html', '_self', '1', '1', '', null), ('201', '系统设置', 'fa fa-gears', 'page/setting.html', '_self', '0', '2', '', null), ('202', '表格示例', 'fa fa-file-text', 'page/table.html', '_self', '0', '2', '', null), ('203', '分步表单', 'fa fa-navicon', 'page/form-step.html', '_self', '0', '2', '', null), ('204', '其它界面', 'fa fa-snowflake-o', null, '_self', '0', '2', '', null), ('205', '组件', 'fa fa-lemon-o', null, '_self', '0', '2', '', null), ('2001', '表单示例', 'fa fa-calendar', null, '_self', '0', '202', '', null), ('2002', '普通表单', 'fa fa-list-alt', 'page/form.html', '_self', '0', '202', '', null), ('2003', '按钮示例', 'fa fa-snowflake-o', 'page/button.html', '_self', '0', '204', '', null), ('2004', '弹出层', 'fa fa-shield', 'page/layer.html', '_self', '0', '204', '', null), ('2005', '图标列表', 'fa fa-dot-circle-o', 'page/icon.html', '_self', '0', '205', '', null), ('2006', '文件上传', 'fa fa-arrow-up', 'page/upload.html', '_self', '0', '205', '', null), ('2007', '富文本编辑器', 'fa fa-edit', 'page/editor.html', '_self', '0', '205', '', null), ('2008', '省市县区选择器', 'fa fa-rocket', 'page/area.html', '_self', '0', '205', '', null);
COMMIT;

delete from `iadminos_portal_menu` where id = 26;
insert into `iadminos_portal_menu` ( `target`, `id`, `title`, `href`, `sort_num`, `parent_id`, `icon`) values ( '_self', '26', '管理员账号', 'page/portal_admin/index.html', '9999', '1', 'fa fa-list-alt');

-- ----------------------------
--  Table structure for `iadminos_user`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_user`;
CREATE TABLE `iadminos_user` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'UID',
  `username` varchar(100) NOT NULL DEFAULT '' COMMENT '用户名',
  `nickname` varchar(50) DEFAULT '' COMMENT '昵称',
  `password` varchar(64) NOT NULL DEFAULT '' COMMENT '密码',
  `salt` varchar(32) DEFAULT NULL COMMENT '随机加密因子',
  `reg_time` int(11) DEFAULT '0' COMMENT '注册时间',
  `avatar` varchar(500) DEFAULT '' COMMENT '头像',
  `mobile` varchar(20) DEFAULT '' COMMENT '手机号',
  `sex` tinyint(4) DEFAULT '0' COMMENT '性别，1男2女0未知',
  `email` varchar(50) DEFAULT '' COMMENT '邮箱',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username_unique_key` (`username`)
) ENGINE=InnoDB;

-- ----------------------------
--  Table structure for `iadminos_user_session`
-- ----------------------------
DROP TABLE IF EXISTS `iadminos_user_session`;
CREATE TABLE `iadminos_user_session` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint(20) DEFAULT '0' COMMENT '用户id',
  `token` varchar(64) DEFAULT '' COMMENT '登录token',
  `client` varchar(32) DEFAULT '' COMMENT '客户端来源',
  `times` int(6) DEFAULT '0' COMMENT '登录次数',
  `login_time` int(11) DEFAULT '0' COMMENT '登录时间',
  `expires_time` int(11) DEFAULT '0' COMMENT '过期时间',
  `ext_data` text COMMENT 'json data here',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB;


-- ----------------------------
--  Table structure for `oauth_access_tokens`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_access_tokens`;
CREATE TABLE `oauth_access_tokens` (
  `access_token` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
  `client_id` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `user_id` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `expires` timestamp NOT NULL,
  `scope` varchar(4000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`access_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Records of `oauth_access_tokens`
-- ----------------------------
INSERT INTO `oauth_access_tokens` VALUES ('09987bbb534ca52fd3a5780907952c3aa824bca6', 'iadminos', 'admin', '2020-12-05 18:01:12', null), ('5241535ec11a8b3a99fb1a1f78f21debdc4853ad', 'iadminos', 'admin', '2020-12-05 18:00:44', null), ('89cf050067036666372ec234849827bc27c4086c', 'iadminos', 'admin', '2020-12-05 18:00:23', null), ('ecb37aa31ddea05efa6c2675cdac9b9daa72d501', 'iadminos', 'admin', '2020-12-05 18:02:21', null);

-- ----------------------------
--  Table structure for `oauth_authorization_codes`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_authorization_codes`;
CREATE TABLE `oauth_authorization_codes` (
  `authorization_code` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
  `client_id` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `user_id` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `redirect_uri` varchar(2000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `expires` timestamp NOT NULL,
  `scope` varchar(4000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `id_token` varchar(1000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`authorization_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Table structure for `oauth_clients`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_clients`;
CREATE TABLE `oauth_clients` (
  `client_id` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `client_secret` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `redirect_uri` varchar(2000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `grant_types` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `scope` varchar(4000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `user_id` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`client_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Records of `oauth_clients`
-- ----------------------------
INSERT INTO `oauth_clients` VALUES ('iadminos', '123456', 'http://demo.iadminos.com/admin/', null, null, null);

-- ----------------------------
--  Table structure for `oauth_jwt`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_jwt`;
CREATE TABLE `oauth_jwt` (
  `client_id` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `subject` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `public_key` varchar(2000) COLLATE utf8mb4_general_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Table structure for `oauth_refresh_tokens`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_refresh_tokens`;
CREATE TABLE `oauth_refresh_tokens` (
  `refresh_token` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
  `client_id` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `user_id` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `expires` timestamp NOT NULL,
  `scope` varchar(4000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`refresh_token`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Records of `oauth_refresh_tokens`
-- ----------------------------
INSERT INTO `oauth_refresh_tokens` VALUES ('1493b59ea7d13d9a03e1db8571ce5abadeeceaae', 'iadminos', 'admin', '2020-12-19 17:00:23', null), ('1ca697a4fae04988412c03a040965fe3cec105b9', 'iadminos', 'admin', '2020-12-19 17:00:44', null), ('580e34ef535629a9510a7926f2fe60af30bc7dd9', 'iadminos', 'admin', '2020-12-19 17:02:21', null), ('941a7ac267340c7ae85711e0aa42f6e11db24559', 'iadminos', 'admin', '2020-12-19 17:01:12', null);

-- ----------------------------
--  Table structure for `oauth_scopes`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_scopes`;
CREATE TABLE `oauth_scopes` (
  `scope` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `is_default` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`scope`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Table structure for `oauth_users`
-- ----------------------------
DROP TABLE IF EXISTS `oauth_users`;
CREATE TABLE `oauth_users` (
  `username` varchar(80) COLLATE utf8mb4_general_ci NOT NULL,
  `password` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `first_name` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `last_name` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `email` varchar(80) COLLATE utf8mb4_general_ci DEFAULT NULL,
  `email_verified` tinyint(1) DEFAULT NULL,
  `scope` varchar(4000) COLLATE utf8mb4_general_ci DEFAULT NULL,
  PRIMARY KEY (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- ----------------------------
--  Records of `oauth_users`
-- ----------------------------
INSERT INTO `oauth_users` VALUES ('admin', '7c4a8d09ca3762af61e59520943dc26494f8941b', '张', '三丰', null, null, null);

SET FOREIGN_KEY_CHECKS = 1;
